package com.dm.dmspringbootdemo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author luhui
 */
@RestController
public class DbController {

    /**
     * 注入jdbcTemplate模板对象
     */
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @GetMapping("/")
    public List index() {
        return jdbcTemplate.queryForList("SELECT banner as 版本信息 FROM v$version");
    }
    @GetMapping("/test")
    public List test() {
        return jdbcTemplate.queryForList("select CITY_ID,CITY_NAME,REGION_ID from TEST_SA.CITY");
    }

    @GetMapping("/queryDbVersion")
    public List queryDbVersion() {
        return jdbcTemplate.queryForList("SELECT banner as 版本信息 FROM v$version");
    }
}
